﻿using System;
using System.Runtime.CompilerServices;
using Core;
using Core.Base;
using Core.Mgrs;
using UnityEngine;
using UnityEngine.UI;

namespace Global.Game
{
    public class GamePanel : BasePanel<GamePanel>
    {
        public Button btnReturn;
        public Button btnEventTest;

        public override void OnInit()
        {
            base.OnInit();

            btnReturn.BindEvent(delegate
            {
                KKGL.SceneMgr.LoadHall(delegate
                {
                    KKGL.UIEvent.Notify(EHall.SetHallPanelShowState, ValueTuple.Create(true));
                });
            });

            btnEventTest.BindEvent(OnBtnEventTestClick);

            KKGL.UIEvent.RegHandler(EHall.TestRobot, TestRobot, TokenSource.Token);
        }

        private void TestRobot(ITuple obj)
        {
            Debug.Log("Robot Run--------------Game");
        }

        private void OnBtnEventTestClick()
        {
            KKGL.UIEvent.Notify(EHall.TestRobot);
        }
    }
}